free(node->domains[i].vbds);
}
+/* Get the back driver type for Virtual Block Device */
+unsigned int xenstat_vbd_type(xenstat_vbd * vbd)
+{
+ return vbd->back_type;
+}
+
/* Get the major number of VBD device */
unsigned int xenstat_vbd_dev(xenstat_vbd * vbd)
{
/*
* VBD functions - extract information from a xen_vbd
*/
+
+/* Get the back driver type for Virtual Block Device */
+unsigned int xenstat_vbd_type(xenstat_vbd * vbd);
+
/* Get the device number for Virtual Block Device */
unsigned int xenstat_vbd_dev(xenstat_vbd * vbd);
int ret;
char buf[256];
+ ret = sscanf(dp->d_name, "%3s-%u-%u", buf, &domid, &vbd.dev);
+ if (ret != 3)
+ continue;
- ret = sscanf(dp->d_name, "vbd-%u-%u", &domid, &vbd.dev);
- if (ret != 2)
+ if (strcmp(buf,"vbd") == 0)
+ vbd.back_type = 1;
+ else if (strcmp(buf,"tap") == 0)
+ vbd.back_type = 2;
+ else
continue;
domain = xenstat_node_domain(node, domid);
if (domain == NULL) {
fprintf(stderr,
- "Found interface vbd-%u-%u but domain %u"
+ "Found interface %s-%u-%u but domain %u"
" does not exist.\n",
- domid, vbd.dev, domid);
+ buf, domid, vbd.dev, domid);
continue;
}
};
struct xenstat_vbd {
- unsigned int dev;
- unsigned long long oo_reqs;
- unsigned long long rd_reqs;
- unsigned long long wr_reqs;
+ unsigned int back_type;
+ unsigned int dev;
+ unsigned long long oo_reqs;
+ unsigned long long rd_reqs;
+ unsigned long long wr_reqs;
};
extern int xenstat_collect_networks(xenstat_node * node);